Expand description
Rust bindings for JACK, a real-time audio and midi library.
Server
JACK provides a high priority server to manipulate audio and midi across applications. The rust
jack crate does not provide server creation functionality, so a server has to be set up with the
jackd
commandline tool, qjackctl
the gui tool, or another method.
Client
Typically, applications connect clients to the server. For the rust jack crate, a connection can
be made with client::Client::new
, which returns a client::Client
.
The Client
can query the server for information, register ports, and manage connections for
ports.
To commence processing audio/midi and other information in real-time, rust jack provides the
Client::activate_async
, which consumes the Client
, an object that implements
NotificationHandler
and an object that implements ProcessHandler
and returns a
AsyncClient
. AsyncClient
processes the data in real-time with the provided handlers.
Port
A Client
may obtain port information through the Client::port_by_id
and
Client::port_by_name
methods. These ports can be used to manage connections or to obtain port
metadata, though their port data (audio buffers and midi buffers) cannot be accessed safely.
Ports can be registered with the Client::register_port
method. This requires a PortSpec
. The
jack crate comes with common specs such as AudioIn
, AudioOut
, MidiIn
, and
MidiOut
.
To access the data of registered ports, use their specialized methods within a ProcessHandler
callback. For example, Port<AudioIn>::as_mut_slice
returns a audio buffer that can be written
to.
Re-exports
pub use jack_sys;
Structs
AudioIn
implements the PortSpec
trait which, defines an
endpoint for JACK. In this case, it is a readable 32 bit floating
point buffer for audio.AudioOut
implements the PortSpec
trait, which defines an
endpoint for JACK. In this case, it is a mutable 32 bit floating
point buffer for audio.process
callback. This is called every time data from ports
is available from JACK.MidiIn
implements the PortSpec
trait, which defines an endpoint for JACK. In this case, it
defines midi input.Port<MidiIn>
.MidiOut
implements the PortSpec
trait, which defines an endpoint for JACK. In this case, it
defines a midi output.ProcessScope
provides information on the client and frame time information within a process
callback.TransportState
and TransportPosition
.PortSpec
for a port that holds has no readable or writeable data from JACK on the created
client. It can be used to connect ports or to obtain metadata.